﻿using System.ComponentModel;
using System.Windows;
using ReflectionStudio.Core.Events;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class THR20RT
    {
        bool IsHRChked = true;
        public THR20RT()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VHRSTAMM();
            this.DataContext = MV;
            InitializeComponent();
        } 
       

        //根据班次，织机，找到挡车工列表，选择挡车工
        public override void OnEXAUFChg(string vlaue)
        {
            try
            {
                dwData = TBMain.NewRow();
                string sql = "";
                SResult = TMV.QHRRTWVER(sql);
                MergeData(SResult, false);
                base.OnEXAUFChg(vlaue);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);

            }
           
        }
        public override void CHKWVER()
        {
            try
            {
                TBMain.Clear();
                if (MachineName.Trim() == "")
                    return;
                if (SHIFT.Trim() == "")
                    return;
                string sdate = Helpers.Helper.GetDateAddDays(TMV.date, -1);
                string sql = " and MC.MachineName = '" + MachineName + "'  and CL.TeamID =" + SHIFT + " and ClassStartTime>='" + sdate + "'";
                if (app.IsSQLDEMO)
                {
                    SResult = TMV.QHRRTDEMO(sql);
                }
                else
                {
                    SResult = TMV.QHRRTWVER(sql);
                }
                MergeData(SResult, true, true);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);

            }
           
        }

      
    }

}
